package com.example.shaidemo;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class HushenFragment extends Fragment {
    private RecyclerView recyclerView;

    private List<Hushen> hushen_list=new ArrayList<>();

    HushenAdapter hushenAdapter;





    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_hushen, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        recyclerView=view.findViewById(R.id.hushen_list);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(),RecyclerView.VERTICAL,false);
        recyclerView.setLayoutManager(layoutManager);
        //加载工资列表

        hushen_list.add(0,new Hushen(1,"薪资","未审核","保险顾问","中国平安证券","6833/月","深圳"));
        hushen_list.add(1,new Hushen(2,"打车","未审核","成都工业学院郫都校区（1号门）","西南财经大学柳林校区（东北门）","35.12","成都"));
        hushen_list.add(2,new Hushen(3,"酒店","未审核","成都格兰朵酒店","1晚","203","绵阳"));
        hushen_list.add(3,new Hushen(4,"酒店","已审核","海上海泊晶酒店","3时","94","成都"));
        hushen_list.add(4,new Hushen(5,"薪资","已审核","JAVA","蚂蚁金服网络技术有限公司","47300/月","上海"));

        /*
        *
        *         recyclerView = findViewById(R.id.recycler_view);
//        通过LayoutManager来呈现出列表或者横向滑动列表或者是瀑布流的效果
//        横向或者竖向的列表布局
        LinearLayoutManager layoutManager = new LinearLayoutManager(this,0,false);
//        瀑布流布局
        StaggeredGridLayoutManager layoutManager1=new StaggeredGridLayoutManager(3,1);
//          网格布局
        GridLayoutManager layoutManager2 = new GridLayoutManager(this,2);
        recyclerView.setLayoutManager(layoutManager);
        FruitAdapter adapter = new FruitAdapter(flist);
        recyclerView.setAdapter(adapter);
        * */

        hushenAdapter = new HushenAdapter(hushen_list);
        recyclerView.setAdapter(hushenAdapter);
        //setListViewHeightBasedOnChildren(listView);
    }
}